package thread;

import java.util.Hashtable;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.locks.ReentrantLock;

public class ForThread implements Runnable{

    private ThreadPoolExecutor executor;
    private String str;
    private Hashtable<String, Object> table;
    private int i;

    public ForThread(ThreadPoolExecutor executor, String str, Hashtable<String, Object> table, int i) {
        this.executor = executor;
        this.str = str;
        this.table = table;
        this.i = i;
    }

    @Override
    public void run() {
        synchronized (ForThread.class){
            table.put("orderNo", str);
        }
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        i++;
        System.out.println("i："+ i);
        System.out.println("str地址："+ System.identityHashCode(str));
        System.out.println(Thread.currentThread().getName()+"==============" + table.get("orderNo"));
        //System.out.println(Thread.currentThread().getName()+"==============" + str);
    }
}
